Skip to content

Detonate Ivan Bombs placed by the attacker using custom warhead. - #2365

Open
dh381-1 wants to merge 16 commits into
Phobos-developers:developfrom
dh381-1:develop
Open

Detonate Ivan Bombs placed by the attacker using custom warhead.#2365
dh381-1 wants to merge 16 commits into
Phobos-developers:developfrom
dh381-1:develop

Conversation

@dh381-1

@dh381-1 dh381-1 commented Aug 23, 2026

Copy link
Copy Markdown

What kind of change is this?

  • New feature, vanilla bugfix or enhancement of a released feature - changelog, docs and credits entries are needed.
  • Improvement to a new (unreleased) feature - docs and credits entries are needed; no changelog entry (Skip Changelog).
  • Bugfix to a new (unreleased) feature - credits entry is needed; no changelog or docs entries (Skip Changelog, Skip Docs).
  • Bugfix to an old (released) feature - changelog and credits entries are needed; no docs entry (Skip Docs).
  • Completely minor change (e.g. a typo fix) - no entries are needed (Skip Changelog, Skip Docs, Skip Credits).

Description

  • Now you can detonate planted Ivan bombs using custom warhead. The bomb attached to the targeted unit will explode immediately, provided that it was planted by the attacker.
  • Use IvanBomb.Detonate.InvokerOnly to configure whether the warhead can detonate Ivan bombs from other sources.
  • Use IvanBomb.Detonate.AffectsType to configure which targets' Ivan bombs can be detonated by warhead, use empty for all types.

In rulesmd.ini:

[SOMEWARHEAD]                             ; WarheadType
IvanBomb.Detonate=true                    ; boolean
IvanBomb.Detonate.InvokerOnly=false       ; boolean
IvanBomb.Detonate.AffectsType=HTNK,E1     ; List of Registration Name, use empty list for all types

@phoboscn-bot

Copy link
Copy Markdown

To Chinese users:
This pull request has been mentioned on Phobos CN. There might be relevant details there:

致中文用户:
此拉取请求已在 Phobos CN 上被提及。那里可能有相关详细信息:

https://www.phoboscn.top/t/topic/725/14

@phoboscn-bot

Copy link
Copy Markdown

To Chinese users:
This pull request has been mentioned on Phobos CN. There might be relevant details there:

致中文用户:
此拉取请求已在 Phobos CN 上被提及。那里可能有相关详细信息:

https://www.phoboscn.top/t/topic/739/1

Comment thread src/Ext/Techno/Hooks.WeaponEffects.cpp Outdated

DEFINE_HOOK(0x702D19, TechnoClass_ReceiveDamage_IvanBombDetonate, 0x6)
{
GET(ObjectClass*, pThis, ESI);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pThis should be TechnoClass*. Besides, register esi has been popped here, I think you should not use it.
pThis 应该是 TechnoClass*。另外,ESI寄存器在此处已被弹出,我认为你不该用它。

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After changing the hook location,register esi can be used
换了一个hook位置,ESI寄存器现在就可以用了

@github-actions

Copy link
Copy Markdown

Nightly build for this pull request:

This comment is automatic and is meant to allow guests to get latest nightly builds for this pull request without registering. It is updated on every successful build.

Comment thread docs/New-or-Enhanced-Logics.md Outdated
In `rulesmd.ini`:
```ini
[SOMEWEAPON] ; WeaponType
IvanBomb.Detonate=true ; Enable bomb detonation (true/false), default: false.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
IvanBomb.Detonate=true ; Enable bomb detonation (true/false), default: false.
IvanBomb.Detonate=false ; boolean

If there is a fixed default value, it should be placed as the value on the right side of the equals sign; only the value type should be written after the semicolon.

@dh381-1 dh381-1 changed the title Detonate Ivan Bombs placed by the attacker using custom weapons. Detonate Ivan Bombs placed by the attacker using custom warhead. Aug 24, 2026
Comment thread src/Ext/WeaponType/Body.h
bool SkipWeaponPicking;

Nullable<bool> CylinderRangefinding;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's this ?

Comment thread src/Ext/Techno/Hooks.ReceiveDamage.cpp Outdated
@NetsuNegi

Copy link
Copy Markdown
Contributor

Other codes looking good

@Coronia Coronia left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this doesn't have to be restricted to the owner's bomb. It would also be useful if another unit could detonate it. Something like this:

IvanBomb.Detonate.InvokerOnly -> whether it can only affect your own bomb or not
IvanBomb.Detonate.AffectsType -> TechnoTypes in this list can have their ivan bomb detonated by this warhead. Use empty list for all types

Comment thread src/Ext/Techno/Hooks.ReceiveDamage.cpp Outdated

if(auto pBomb = pThis->AttachedBomb)
{
if(auto pSourceExt = TechnoExt::Fetch(pSource))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this sanity check is not nesseary

if(!pWHExt->IvanBomb_Detonate)
return 0;

bool CanAffects = pWHExt->IvanBomb_Detonate_AffectsType.Contains(pThis->GetTechnoType())

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it will be better to check empty first

[SOMEWARHEAD] ; WarheadType
IvanBomb.Detonate=true ; boolean
IvanBomb.Detonate.InvokerOnly=false ; boolean
IvanBomb.Detonate.AffectsType=HTNK,E1 ; List of Registration Name, use empty list for all types

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is unreasonable to reinvent a filter here.

return ContinueCheck;
}

DEFINE_HOOK(0x701DFF, TechnoClass_ReceiveDamage_IvanBombDetonate, 0x7)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This hook is redundant.
You should process this in WarheadTypeExt::DetonateOnOneUnit.

if(pWHExt->IvanBomb_Detonate_InvokerOnly)
{
if(pBomb->Owner == pSource && CanAffects)
pBomb->Detonate();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Invoking a damage in another damage process is dangerous.
IMO resetting the timer would be better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants